package main

import (
	"github.com/gin-gonic/gin"
	"miao-server/api"
)

func RegisterRouter(r *gin.RouterGroup) {
	publicRouter(r)
	clientRouter(r) // 客户端的路由
	//branchRouter(r) // 分支机构路由
	//taskRouter(r)   // 任务路由
	//mapRouter(r)    // 矢量地图路由
}

func publicRouter(r *gin.RouterGroup) {
	r.GET("ping", func(c *gin.Context) {
		c.JSON(200, gin.H{"message": "pong"})
	})
}

func clientRouter(r *gin.RouterGroup) {
	sub := r.Group("client")
	//sub.Use(middleware.GinAuthorizationMiddleAware())

	sub.POST("sendInstruct", api.BaseApi.SendInstruct)
	sub.POST("sendInstructR", api.BaseApi.SendInstructR)
	sub.POST("sendNobodyInstruct", api.BaseApi.SendNobodyInstruct)
	sub.POST("startGuarder", api.BaseApi.StartGuarder)
	sub.POST("getPolicy", api.BaseApi.GetPolicy)
	sub.POST("setLogLv", api.BaseApi.SetLogLv)
	sub.POST("updatePlugin", api.BaseApi.UpdatePlugin)
	sub.GET("abnormalOlineDeviceList", api.BaseApi.AbnormalOlineDeviceList)
	sub.GET("olineDevice", api.BaseApi.OlineDevice)
	sub.POST("getPcLoad", api.BaseApi.GetPcLoad)
	sub.POST("clearDB", api.BaseApi.ClearDB)

}
